package com.gec.system.utils;


import com.gec.model.system.ITripUser;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;

public class UserDetailImpl implements UserDetails {

    private ITripUser iTripUser;
    private Collection<? extends GrantedAuthority> authorities;

    public ITripUser getITripUser() {
        return iTripUser;
    }

    public void setSysUser(ITripUser iTripUser) {
        this.iTripUser = iTripUser;
    }



    public UserDetailImpl() {
    }

    public UserDetailImpl(ITripUser iTripUser, Collection<? extends GrantedAuthority> authorities) {
        this.iTripUser = iTripUser;
        this.authorities = authorities;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return this.authorities;
    }

    @Override
    public String getPassword() {
        return this.iTripUser.getPassword();
    }

    @Override
    public String getUsername() {
        return this.iTripUser.getUsername();
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}
